package com.smartao.core.license;

import java.io.File;
import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.smartao.core.BaseContext;
import com.smartao.core.Environment;

public class LicenseLoader {
	
	private static LicenseManager licenseManager = new LicenseManager();
	private static final Logger logger = LoggerFactory.getLogger(LicenseLoader.class);

	/**
	 * 初始化License信息
	 * @throws IOException 
	 */
	public static void initLicense() {
		logger.info("Loading license...");
		File file = new File(BaseContext.getRootPath() + Environment.LICENSE_FILE);
		License license = licenseManager.loadLicense(file);
		BaseContext.setLicense(license);
	}
}
